The present invention is generally related to graphical image manipulation systems, and more particularly to a method for compositing multiple graphical images.
A graphical image manipulation computer program, such as Adobe Photoshop 4.0, from Adobe Systems Incorporated, of San Jose, Calif., may store a graphical image as a set of image layers. Such a program builds a final image by compositing the image layers together. The image layers may be thought of as stacked sheets of acetate. The density of the ink on the acetate controls the transparency of the sheet, i.e., the extent to which the sheet obscures the underlying sheets. In the computer program, the color and density of the ink on the acetate sheet are represented by a color value and an opacity (or "alpha") value, respectively.
Referring to FIG. 1, a conventional graphical image document 10 includes a set of image layers 12, denoted as layers 1, 2, . . . , n, organized in a layer stack. The bottom layer, i.e., layer 1, acts as the background or bottom sheet, whereas the other layers, i.e., layers 2, 3, . . . , n, act as the transparencies which are overlaid on the background.
Referring to FIG. 2, each image layer 12 typically includes an image 14, an optional mask or masks 16, and compositing controls 18. Typically, the image 14 is represented by an array of pixels, with each pixel having a color and, optionally, an opacity. Similarly, the mask 16 is typically represented by an array of pixels, with each pixel having an opacity. However, the image 14 and the mask 16 could be defined analytically, e.g., by using shape outlines, or by other functions which define color and/or opacity as a function of position. In addition, the image 14 and the mask 16 can be dynamic, i.e., computed at the time the layers are composited from the results of compositing the underlying layers or other data. For example, one layer in the document could be a filter or an adjustment layer in which the data representing the image is determined from the data in an underlying image layer.
The compositing controls 18 may include a global opacity 18a and a transfer mode 18b. The global opacity 18a controls, in essence, the transparency of the entire image layer 12, whereas the transfer mode determines how the colors in the image layer 12 mix with the colors accumulated from the underlying layers. The compositing controls may also be considered to include dynamic masks.
The process of stacking the acetate sheets to form the final image is modeled by an accumulation buffer which stores a composited color for each pixel. The image layers are composited in order from bottom to top. Referring to FIG. 3, a conventional process 20 for compositing an image layer begins by calculating any dynamic data in the image layer, such as the color of the pixels in the image or the opacity of the pixels in the mask (step 22). Then the opacity of each pixel is determined from the mask 16, the global opacity 18a, and, if appropriate, the image 14 (step 24). Finally, the color of each pixel in the image layer is combined with the composited color of the corresponding pixel in the accumulation buffer to generate a new composited color (step 26). The combination is controlled by the opacity of the layer pixel and the transfer mode 18b. This process is iterated for each layer until all the layers have been composited, thus generating the final image.
There are a variety of situations in which a user may wish to group individual layers together and work with the group as a single entity. For example, the user may wish to apply an effect to a group of layers to generate the visual appearance that the group is actually a single layer. Alternately, the grouping may be required by the graphical image manipulation program which generated the layers. Unfortunately, conventional graphical image manipulation programs have been unable to apply opacity and transfer mode effects to groups of layers properly. In addition, conventional programs generate image defects when dynamic images or dynamic masks are included in layer groups.
Referring to FIG. 4, one conventional method of compositing the layers 1, 2, . . . , n, of a layer stack 30 is termed "reassociation". In this method, the constituent image layers G, G+1, . . . , G+k of a layer group 32 are separately composited to form an intermediate layer 34. Then the intermediate layer 34 is composited as an image layer in the layer stack 30 to form a final image 36. However, if any image layer in the group 32 contains dynamic data which depends on an underlying image layer, i.e., layers 1, 2, . . . , G-1, the compositing process will not generate the intended result because the underlying data is unavailable. In addition, the compositing controls associated with the individual image layers G, G+1, G+k in the group 32 do not interact with the data from the underlying image layers 1, 2, . . . , G-1. Thus, many opacity and transfer mode effects will not generate the intended result.
Referring to FIG. 5, another conventional method of compositing a layer stack 40 is termed "distribution". In this method, the group compositing effect is installed in each image layer G, G+1, . . . , G+k, in the group 42 to generate modified layers G', (G+1)', . . . , (G+k)'. Then the image layers 1, 2, . . . , n are composited to generate a final image 44. Unfortunately, this technique does not permit individual image layers to have a transfer mode which differs from the transfer mode of the group. Furthermore, if an effect changes the opacity of the images the group of layers, previously obscured elements in the group may become visible.